<?php get_header(); ?>

<div class="clearfix post_nav">
	<span class="f_left">
		<?php echo previous_post_link('%link','&lt;&lt; %title') ?>
	</span>
	<span class="f_right">
		<?php echo next_post_link('%link','%title &gt;&gt;') ?>
	</span>
</div>



<div id="post_title" class="clearfix">
	<h1 class="post_title f_left"><?php the_title(); ?></h1>
    <a href="<?php echo bloginfo('url')?>" class="f_right">Back To Sets</a>
</div>


<div class="post clearfix">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>   

	


    <div class="entry clearfix">
    	
    	
    <div id="rg-gallery" class="rg-gallery">
		<div class="rg-thumbs">
			<!-- Elastislide Carousel Thumbnail Viewer -->
			<div class="es-carousel-wrapper">
				<div class="es-nav">
					<span class="es-nav-prev">Previous</span>
					<span class="es-nav-next">Next</span>
				</div>
				<div class="es-carousel">
					<ul>
						<?php
							$setId = get_post_meta($post->ID, "fsAutoPost", true);
							$photos = getPhotosBySetId($setId);
							$setInfo = getSetInfo($setId);
						?>	
							
						<?php	
							if($photos){
								foreach($photos as $index=>$photo){
									$mUrl = getFlickrImgUrl($photo, "m");
									$bUrl = getFlickrImgUrl($photo, "b");
									$oUrl = getFlickrImgUrl($photo, "o");
									$sUrl = getFlickrImgUrl($photo, "s");
									$isPrimary = $photo->isprimary == 1 ? true : false;
						?>
						<li>
							<a class="thumb"
								<?php if($isPrimary) echo 'id="thumbnail-primary"'?>
								title="<?php echo $photo->title ?>"
								photo-index="<?php echo $index ?>" 
								set-id="<?php echo $setId ?>"
								href="<?php echo $bUrl ?>">
								<img 
									src="<?php echo $sUrl ?>" 
									ref="<?php echo $bUrl ?>" 
									data-description="<?php echo $photo->title ?>" 
									alt="<?php echo $photo->title ?>" 
									data-large="<?php echo $bUrl ?>" 
									data-pid="<?php echo $photo->id?>" 
									data-original="<?php echo $oUrl ?>" 
								/>
							</a>
						</li>
						<?php
								}
							}
						?>
					</ul>
				</div>
			</div>
		</div><!-- rg-thumbs -->
	</div><!-- rg-gallery -->
	<div id="photo_extra">
		<p>
			<a href="#" target="_blank" id="originalSizeBtn">View Original Size in New Tab</a>
			<a href="#" id="exifBtn">View Exif Info</a>
		</p>
	</div>
	
	
	
	</div><!-- end entry -->
	<?php endwhile; ?>
	<?php endif; ?>	        
</div><!-- end post -->





<script type="text/javascript" src="<?php echo assetsPath('js/component/gallery/js/jquery.tmpl.min.js') ?>"></script>
<script type="text/javascript" src="<?php echo assetsPath('js/component/gallery/js/jquery.easing.1.3.js') ?>"></script>
<script type="text/javascript" src="<?php echo assetsPath('js/component/gallery/js/jquery.elastislide.js') ?>"></script>
<script type="text/javascript" src="<?php echo assetsPath('js/component/gallery/js/gallery.js')."?".time() ?>"></script>

<script id="img-wrapper-tmpl" type="text/x-jquery-tmpl">	
	<div class="rg-image-wrapper">
		{{if itemsCount > 1}}
			<div class="rg-image-nav">
				<a href="#" class="rg-image-nav-prev">Previous Image</a>
				<a href="#" class="rg-image-nav-next">Next Image</a>
			</div>
		{{/if}}
		<div class="rg-image"></div>
		<div class="rg-loading"></div>
		<div class="rg-caption-wrapper">
			<div class="rg-caption" style="display:none;">
				<p></p>
			</div>
		</div>
	</div>
</script>


<!-- END post -->        
<?php get_sidebar(); ?>
<?php get_footer(); ?>